home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / include / out.h < prev    next >
C/C++ Source or Header  |  1990-07-15  |  3KB  |  120 lines

  1. #ifndef _OUT_H
  2. #define _OUT_H
  3. /*
  4.  * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
  5.  * See the copyright notice in the file "../Copyright".
  6.  */
  7. /*
  8.  * output format for ACK assemblers
  9.  */
  10. #ifndef ushort
  11. #define ushort    unsigned short
  12. #endif ushort
  13.  
  14. struct outhead {
  15.     ushort     oh_magic;    /* magic number */
  16.     ushort     oh_stamp;    /* version stamp */
  17.     ushort    oh_flags;    /* several format flags */
  18.     ushort    oh_nsect;    /* number of outsect structures */
  19.     ushort    oh_nrelo;    /* number of outrelo structures */
  20.     ushort    oh_nname;    /* number of outname structures */
  21.     long    oh_nemit;    /* sum of all os_flen */
  22.     long    oh_nchar;    /* size of string area */
  23. };
  24.  
  25. #define O_MAGIC    0x0201        /* magic number of output file */
  26. #define    O_STAMP    0        /* version stamp */
  27. #define MAXSECT    64        /* Maximum number of sections */
  28.  
  29. #define    HF_LINK    0x0004        /* unresolved references left */
  30. #define    HF_8086    0x0008        /* os_base specially encoded */
  31.  
  32. struct outsect {
  33.     long     os_base;    /* startaddress in machine */
  34.     long    os_size;    /* section size in machine */
  35.     long    os_foff;    /* startaddress in file */
  36.     long    os_flen;    /* section size in file */
  37.     long    os_lign;    /* section alignment */
  38. };
  39.  
  40. struct outrelo {
  41.     char    or_type;    /* type of reference */
  42.     char    or_sect;    /* referencing section */
  43.     ushort    or_nami;    /* referenced symbol index */
  44.     long    or_addr;    /* referencing address */
  45. };
  46.  
  47. struct outname {
  48.     union {
  49.       char    *on_ptr;    /* symbol name (in core) */
  50.       long    on_off;        /* symbol name (in file) */
  51.     }    on_u;
  52. #define on_mptr    on_u.on_ptr
  53. #define on_foff    on_u.on_off
  54.     ushort    on_type;    /* symbol type */
  55.     ushort    on_desc;    /* debug info */
  56.     long    on_valu;    /* symbol value */
  57. };
  58.  
  59. /*
  60.  * relocation type bits
  61.  */
  62. #define RELSZ    0x07        /* relocation length */
  63. #define RELO1       1        /* 1 byte */
  64. #define RELO2       2        /* 2 bytes */
  65. #define RELO4       4        /* 4 bytes */
  66. #define RELPC    0x08        /* pc relative */
  67. #define RELBR    0x10        /* High order byte lowest address. */
  68. #define RELWR    0x20        /* High order word lowest address. */
  69.  
  70. /*
  71.  * section type bits and fields
  72.  */
  73. #define S_TYP    0x007F        /* undefined, absolute or relative */
  74. #define S_EXT    0x0080        /* external flag */
  75. #define S_ETC    0x7F00        /* for symbolic debug, bypassing 'as' */
  76.  
  77. /*
  78.  * S_TYP field values
  79.  */
  80. #define S_UND    0x0000        /* undefined item */
  81. #define S_ABS    0x0001        /* absolute item */
  82. #define S_MIN    0x0002        /* first user section */
  83. #define S_MAX    S_TYP        /* last user section */
  84.  
  85. /*
  86.  * S_ETC field values
  87.  */
  88. #define S_SCT    0x0100        /* section names */
  89. #define S_LIN    0x0200        /* hll source line item */
  90. #define S_FIL    0x0300        /* hll source file item */
  91. #define S_MOD    0x0400        /* ass source file item */
  92. #define S_COM    0x1000        /* Common name. */
  93.  
  94. /*
  95.  * structure format strings
  96.  */
  97. #define SF_HEAD        "22222244"
  98. #define SF_SECT        "44444"
  99. #define SF_RELO        "1124"
  100. #define SF_NAME        "4224"
  101.  
  102. /*
  103.  * structure sizes (bytes in file; add digits in SF_*)
  104.  */
  105. #define SZ_HEAD        20
  106. #define SZ_SECT        20
  107. #define SZ_RELO        8
  108. #define SZ_NAME        12
  109.  
  110. /*
  111.  * file access macros
  112.  */
  113. #define BADMAGIC(x)    ((x).oh_magic!=O_MAGIC)
  114. #define OFF_SECT(x)    SZ_HEAD
  115. #define OFF_EMIT(x)    (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
  116. #define OFF_RELO(x)    (OFF_EMIT(x) + (x).oh_nemit)
  117. #define OFF_NAME(x)    (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
  118. #define OFF_CHAR(x)    (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
  119. #endif /* _OUT_H */
  120.